/*
 * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
 * Use of this source code is governed by a MIT license that can be
 * found in the LICENSE file.
 */
#ifndef SKIA_DOM_VIEW_COMPONENT_DESCRIPTOR_H
#define SKIA_DOM_VIEW_COMPONENT_DESCRIPTOR_H
#pragma once

#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/components/view/ViewShadowNode.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/core/propsConversions.h>

namespace facebook {
namespace react {
inline const char SkiaDomViewComponentName[] = "SkiaDomView";

class SkiaDomViewProps : public ViewProps {
public:
    SkiaDomViewProps() = default;

    SkiaDomViewProps(const PropsParserContext &context, const SkiaDomViewProps &sourceProps, const RawProps &rawProps)
        : ViewProps(context, sourceProps, rawProps),
          mode(CoreFeatures::enablePropIteratorSetter ?
        sourceProps.mode :
        convertRawProp(context, rawProps, "mode", sourceProps.mode, {})),
          debug(CoreFeatures::enablePropIteratorSetter ?
        sourceProps.debug :
        convertRawProp(context, rawProps, "debug", sourceProps.debug, { true }))
    {}

    std::string mode{};
    bool debug{ true };
};

class SkiaDomViewEventEmitter : public ViewEventEmitter {
public:
    using ViewEventEmitter::ViewEventEmitter;
};

using SkiaDomViewShadowNode =
    ConcreteViewShadowNode<SkiaDomViewComponentName, SkiaDomViewProps, SkiaDomViewEventEmitter>;

class SkiaDomViewComponentDescriptor final : public ConcreteComponentDescriptor<SkiaDomViewShadowNode> {
public:
    explicit SkiaDomViewComponentDescriptor(ComponentDescriptorParameters const & parameters)
        : ConcreteComponentDescriptor(parameters)
    {}
};
} // namespace react
} // namespace facebook
#endif // SKIA_DOM_VIEW_COMPONENT_DESCRIPTOR_H
